/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package service;

import javax.annotation.PostConstruct;
import javax.ejb.Remove;
import javax.ejb.Stateful;

/**
 *
 * @author thaidacvinh
 */
@Stateful
public class StatefulSessionBean implements StatefulSessionBeanLocal {

    private String lastClient;
    private int servedCount;
    
    @PostConstruct
    public void init() {
        lastClient = "None";
        servedCount = 0;
    }
    
    @Override
    public String getInfo(String client) {
        String info = "Last client: " + lastClient + "; Served count: " + servedCount;
        lastClient = client;
        servedCount++;
        return info;
    }
    
    @Override @Remove
    public void release() {
    }

}
